package com.ysx.student.service;

import com.ysx.annotation.Authentication;
import com.ysx.student.bean.StudentBean;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class StudentService {


    @Authentication(check = true)
    public Integer deleteStudent(StudentBean studentBean) {
        //1 先要检验当前用户的角色  系统管理员 或者 老师   是就可以执行第2步 否则就直接退出
        //2 把学生对象直接入库
        System.out.println("保存到数据库成功" + studentBean);
        return  1;
    }

    @Authentication(check = false)
    public List<StudentBean> findStudentList(StudentBean studentBean) {

        //1 直接查看
        System.out.println("查看成功" + studentBean);
        StudentBean student = new StudentBean("海燕",22,10010  );
        List<StudentBean> list = new ArrayList<>();
        list.add(student);
        return list;
    }
}
